{% extends 'bbs/base.html' %}
{% load staticfiles %}
{% block body %}

    <div class="container">
        <div class="row">
            <div class="col-md-2">
                <div class="row">
                    <ul class="nav nav-tabs nav-stacked">
                        {% for board in boards %}
                            <li><a href="{% url 'topic_list' board.id %}"
                                   class="list-group-item">{{ board.board_title }}</a></li>
                        {% endfor %}
                    </ul>
                </div>
            </div>
            <div class="col-md-10">
                {% for topic in topics %}
                    <div class="row">
                        <div class="col-md-6">
                            <div class="row">
                                <div><a href="{% url 'topic_show' topic.id %}">{{ topic.topic_title }}</a></div>
                            </div>
                            <div class="row">
                                发布于
                                <div>{{ topic.topic_publish_date }}</div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="media">
                                <div class="media-left">
                                    {% if topic.topic_publisher.portrait %}
                                        <img src="/media/{{ topic.topic_publisher.portrait }}"
                                             class="media-object">
                                    {% else %}
                                        <img src="{% static 'img/bbs/none.jpg' %}"
                                             class="media-object">
                                    {% endif %}
                                </div>
                                <div class="media-body">
                                    <h4 class="media-heading">{{ topic.topic_publisher.username }}</h4>
                                    slkflskdf
                                </div>
                            </div>
                        </div>
                    </div>
                    <hr>
                {% endfor %}
                <div class="row">
                    <div class="col-md-8 col-md-offset-2">
                        <nav>
                            <ul class="pagination">
                                {% if topics.has_previous %}
                                    <li>
                                        <a href="?page={{ topics.previous_page_number }}" aria-label="Previous">
                                            <span aria-hidden="true">&laquo;</span>
                                        </a>
                                    </li>
                                {% else %}
                                    <li>
                                        <span aria-hidden="true">&laquo;</span>
                                    </li>
                                {% endif %}
                                {% for page in topics.paginator.page_range %}
                                    <li><a href="?page={{ page }}">{{ page }}</a></li>
                                {% endfor %}
                                {% if topics.has_next %}
                                    <li>
                                        <a href="?page={{ topics.next_page_number }}" aria-label="Next">
                                            <span aria-hidden="true">&raquo;</span>
                                        </a>
                                    </li>
                                {% else %}
                                    <li>
                                        <span aria-hidden="true">&raquo;</span>
                                    </li>
                                {% endif %}
                            </ul>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
    </div>

{% endblock %}